package service

import (
    "github.com/gogf/gf/net/ghttp"
    "webserver/app/dao"
    "webserver/app/define"
)

var (
    HiFuturesAlertConfService = &hiFuturesAlertConfService{}
)

type hiFuturesAlertConfService struct {}

func (s *hiFuturesAlertConfService) SaveFuturesBaseInfo(r *ghttp.Request, data *define.HiFuturesBaseInfoField) error {
    _, err := dao.HiFuturesAlertConf.Ctx(r.Context()).Data(data).Save()
    return err
}

func (s *hiFuturesAlertConfService) SavePriceLine(r *ghttp.Request, code string, data *define.HiFuturesPriceLineField) error {
    _, err := dao.HiFuturesAlertConf.Ctx(r.Context()).Data(data).Where(dao.HiFuturesAlertConf.Columns.Code, code).Update()
    return err
}

func (s *hiFuturesAlertConfService) SaveAlertInfo(r *ghttp.Request, code string, data *define.HiFuturesAlertConfField) error {
    _, err := dao.HiFuturesAlertConf.Ctx(r.Context()).Data(data).Where(dao.HiFuturesAlertConf.Columns.Code, code).Update()
    return err
}
